DWTVT100

;; $Id: DWTVT100.m 4 2010-10-24 17:30:25Z jollis $

INIT()
 S ^DWIO("TERMINALS","vt100")=""
 S ^DWIO("TERMINALS","vt100","COLORS","BG","BLACK")=40
 S ^DWIO("TERMINALS","vt100","COLORS","BG","RED")=41
 S ^DWIO("TERMINALS","vt100","COLORS","BG","GREEN")=42
 S ^DWIO("TERMINALS","vt100","COLORS","BG","YELLOW")=43
 S ^DWIO("TERMINALS","vt100","COLORS","BG","BLUE")=44
 S ^DWIO("TERMINALS","vt100","COLORS","BG","MAGENTA")=45
 S ^DWIO("TERMINALS","vt100","COLORS","BG","CYAN")=46
 S ^DWIO("TERMINALS","vt100","COLORS","BG","WHITE")=47
 S ^DWIO("TERMINALS","vt100","COLORS","FG","BLACK")=30
 S ^DWIO("TERMINALS","vt100","COLORS","FG","RED")=31 
 S ^DWIO("TERMINALS","vt100","COLORS","FG","GREEN")=32
 S ^DWIO("TERMINALS","vt100","COLORS","FG","YELLOW")=33
 S ^DWIO("TERMINALS","vt100","COLORS","FG","BLUE")=34
 S ^DWIO("TERMINALS","vt100","COLORS","FG","MAGENTA")=35
 S ^DWIO("TERMINALS","vt100","COLORS","FG","CYAN")=36
 S ^DWIO("TERMINALS","vt100","COLORS","FG","WHITE")=37
 Q

;;
;; ***********************************************************
;; THE FOLLOWING FUNCTIONS WILL RETURN AN ESCAPE SEQUENCE
;;
;;

SETCOLOR(FG,BG)
 I $G(^DWIO("TERMINALS","vt100","COLORS","FG",FG))="" Q 0
 I $G(^DWIO("TERMINALS","vt100","COLORS","BG",BG))="" Q 0
 Q $C(27)_"["_^DWIO("TERMINALS","vt100","COLORS","FG",FG)_";"_^DWIO("TERMINALS","vt100","COLORS","BG",BG)_"m"

NOATTR()
 Q $C(27)_"[0m"

BOLD()
 Q $C(27)_"[1m"

UNDRLINE()
 Q $C(27)_"[4m"

BLINK()
 Q $C(27)_"[5m"

REVERSE()
 Q $C(27)_"[7m"

CONCEAL()
 Q $C(27)_"[8m"

SETPOS(XPOS,YPOS)
 Q $C(27)_"["_YPOS_";"_XPOS_"f"

CURSUP(VAL)
 Q $C(27)_"["_VAL_"A"

CURSDN(VAL)
 Q $C(27)_"["_VAL_"B"

CURSFRWD(VAL)
 Q $C(27)_"["_VAL_"C"

CURSBACK(VAL)
 Q $C(27)_"["_VAL_"D"

CURSSAVE()
 Q $C(27)_"[s"

CURSRSTR()
 Q $C(27)_"[u"

CLRSCR()
 Q $C(27)_"[2J"

LINEERAS()
 Q $C(27)_"[K"
